<%@ page contentType="text/html; charset=UTF-8" session="true"%>
<%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic" %>
<%@ page import="java.util.*" %>
<%@ page import="com.isomorphic.datasource.*" %>
<%
String roles =  (String)session.getAttribute("roles");
if(roles == null){
	response.sendRedirect("login.jsp");
	return;
}
Map user = (Map)session.getAttribute("currUser");

//重新获得用户，防止用户信息修改后session中的用户没有得到及时更新
DataSource userDS;
try {
    userDS = DataSourceManager.getDataSource("user");
} catch (Exception e) {
    throw new Exception("Could not load user or company ds");
}
Map c = new HashMap();
c.put("pk",user.get("pk"));
user = userDS.fetchSingle(c);

int width = 120;
if("comAdmin".equals(roles)||"depAdmin".equals(roles)){
	width = 200;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML><HEAD><TITLE>客户管理</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

<!--  -->
<isomorphic:loadISC skin="Graphite"/>

</HEAD><BODY CLASS="" STYLE="overflow:hidden">
<SCRIPT SRC=isomorphic/locales/frameworkMessages_zh_CN.properties.js?a=b1></SCRIPT> 
<script src="reloginFlow.js"></script>
<SCRIPT>
isc.setAutoDraw(false);

// Load DataSources
// ---------------------------------------------------------------------
<isomorphic:loadDS name="customerDS"/>
<isomorphic:loadDS name="customer_categoryDS"/>
<isomorphic:loadDS name="user"/>
<isomorphic:loadDS name="callinDS"/>
<isomorphic:loadDS name="companyDS"/>
<isomorphic:loadDS name="depDS"/>
<isomorphic:loadDS name="blackDS"/>
<isomorphic:loadDS name="sms_send"/>
<isomorphic:loadDS name="sms_task"/>
<isomorphic:loadDS name="sms_config"/>
<isomorphic:loadDS name="mms"/>
<isomorphic:loadDS name="mms_task"/>
<isomorphic:loadDS name="mms_send"/>
<isomorphic:loadDS name="mms_content"/>

var currUserPK = '<%=user.get("pk") %>';
var currUserTruename = '<%=user.get("truename") %>';
var currUserSmsSign = '<%=user.get("sms_sign") %>';
var currUserTelephone = '<%=user.get("telephone") %>';
var currUserSmInterval = '<%=user.get("smInterval")==null?"":user.get("smInterval") %>';
// Set up the app img dir so we pick up the example's images
//isc.Page.setAppImgDir(isc.Page.getIsomorphicDocsDir()+"exampleImages/");
</SCRIPT>

<!--  Pick up application UI and logic from the .js UI file
  ======================================================================
-->
<script src="user.js"></script>

<script type="text/javascript">



		isc.HLayout.create({
			ID:"frameTopSetLayout",
			width: <%=width%>,
			members: [
				<%if("depAdmin".equals(roles)||"comAdmin".equals(roles)){%>
				isc.Label.create({
					width: "80",
					contents: "<div style='cursor:pointer'>系统管理</div>",
					icon: "czgl.gif",
					click:"window.location.href='admin.jsp';",
					align: "right"
				}),		
				<%}%>
				isc.Label.create({
					width: "80",
					contents: "<div style='cursor:pointer'>退出系统</div>",
					icon: "topIcon.png",
					click:"window.location.href='clearSession.jsp';",
					align: "right"
				})
		]
		});


isc.HLayout.create({
	ID:"frameTopLayout",
	width: "100%",
	height:"71",
	memberOverlap:<%=width%>,
	members: [
		isc.StretchImg.create({
			src: "top.jpg",
			vertical:false,
			zIndex:10,
			height:"71",
			items:[
					{name:"start", width:"0"},
					{name:"stretch", width:"*"},
					{name:"end", width:"313"}
			   ]
		})
		,frameTopSetLayout
	]
});

isc.VLayout.create({
	ID:"frameLayout",
	width:"100%",
	height:"100%",
    layoutMargin:10,
	members:[
		frameTopLayout,
		isc.HLayout.create({
			ID:"frameContentLayout",
			width: "100%",
			height:"100%",
			members: [
				isc.SectionStack.create({
					width:120,
					showResizeBar:true,
					visibilityMode:"multiple",
					animateSections:true,
					sections:[
						{title:"导航", autoShow:true, items:[
							isc.ListGrid.create({
								ID:"navList",
								width: "100%",leaveScrollbarGap:false,
								cellHeight:33,showHeader :false,
								fields:[
									{name:"appImgSrc", type:"image", width:24, im2gDir:"pieces/16/"},
									{name:"appName"}
								],
								selectionChanged  : function(record,state){
									frameRightLayout.setMembers([record.appID]);
								}
							}) 
					
						]}
					]
				}),

				isc.VLayout.create({
					ID:"frameRightLayout",
					width:"100%",
					height:"100%",
					top:10,
					members:[]
				})

			]
		})
	]
});
isc.Page.setEvent("load", function(){
	var data=[
			{appName:"客户管理",appImgSrc:"khgl.gif",appID:"userPageLayout"},
			{appName:"黑名单",appImgSrc:"icon_delete.png",appID:"blackApp"},
			{appName:"短信发送",appImgSrc:"icon_edit.png",appID:"smSendApp"},
			{appName:"短信待发",appImgSrc:"zdgl.gif",appID:"willSendApp"},
			{appName:"短信已发",appImgSrc:"08.jpg",appID:"sendedApp"},
			{appName:"短信配制",appImgSrc:"czgl.gif",appID:"smConfigApp"},
			{appName:"彩信发送",appImgSrc:"icon_edit.png",appID:"mmSendApp"},
			{appName:"彩信待发",appImgSrc:"zdgl.gif",appID:"mmsTaskApp"},
			{appName:"彩信已发",appImgSrc:"08.jpg",appID:"mmsSendApp"},
			{appName:"彩信配制",appImgSrc:"czgl.gif",appID:"mmsConfigApp"},
			{appName:"内部短信",appImgSrc:"011.jpg",appID:"innerSmSendApp"},
			{appName:"通话记录",appImgSrc:"hmgl.gif",appID:"callinApp"},
			{appName:"个人设置",appImgSrc:"04.jpg",appID:"changePasswordApp"}
	];
	navList.setData(data);
	frameLayout.draw();
	navList.selectSingleRecord(0);
});
</script>
</BODY>
</HTML>
